home *** CD-ROM | disk | FTP | other *** search
- #include <ctype.h>
-
- #include "global.h"
- #include "mintlib.h"
-
-
- GLOBAL WORD longName(UBYTE *filename)
- {
- PATH path;
- LONG ret;
-
- /* eigentlichen Dateinamen abschneiden und durch '.' ersetzen -
- mu₧ sein, da Datei evtl. noch nicht existiert... */
- file_splitt(filename, path, NULL);
- strcat(path, ".");
- ret = Dpathconf(path, 3);
- if ((ret < 0) || (ret == 12))
- ret = 0;
- return (WORD) ret;
- }
-
-
- GLOBAL BOOLEAN caseSens(UBYTE *filename, WORD *val)
- {
- PATH path;
- LONG ret;
-
- /* Eigentlichen Dateinamen abschneiden und durch '.' ersetzen -
- mu₧ sein, da Datei evtl. noch nicht existiert... */
- file_splitt(filename, path, NULL) ;
- strcat(path, ".") ;
- ret = Dpathconf(path, 6);
-
- if (val != NULL)
- *val = (WORD) ret;
- /*
- * ret = 2 tritt dann auf, wenn zwischen Gro₧/Klein nicht unterschieden
- * wird, man aber Gro₧/Klein im Namen verwenden kann -> MacFS.
- */
- return (ret == 0 || ret == 2);
- }
-
-
- GLOBAL VOID raw_mode(WORD *old)
- {
- /* aus ioctl.h */
- #define TIOCGETP (('T'<< 8) | 0)
- #define TIOCSETP (('T'<< 8) | 25)
- #define CRMOD 0x0001
- #define ECHO 0x0004
- #define RAW 0x0010
-
- struct sgttyb
- {
- BYTE sg_ispeed;
- BYTE sg_ospeed;
- BYTE sg_erase;
- BYTE sg_kill;
- WORD sg_flags;
- } sgtty;
-
- if (mint)
- {
- Fcntl(0, (LONG)&sgtty, TIOCGETP);
- if (*old == 0)
- {
- *old = sgtty.sg_flags;
- sgtty.sg_flags |= RAW;
- }
- else
- sgtty.sg_flags = *old;
- Fcntl(0, (LONG)&sgtty, TIOCSETP);
- }
- }
-
-
- /******************************************************************************/
- /* MiNT-Lib PL46 */
- /******************************************************************************/
-
- /*
- * returns 0 for ordinary files, 1 for special files (like /dev/tty)
- */
- GLOBAL WORD unx2dos(UBYTE *name)
- {
- CONST UBYTE *u;
- UBYTE *d, c;
- PATH unx;
-
- strcpy(unx, name);
- name[0] = 0;
- u = unx;
- d = name;
- if (!strncmp(u, "/dev/", 5))
- {
- u += 5;
- /* make /dev/A/foo the same as A:/foo */
-
- if (*u && isalpha (*u) && (u[1] == 0 || (u[1] == '/' || u[1] == '\\')))
- {
- d[0] = *u++;
- d[1] = ':';
- d += 2;
- }
- /* check for a unix device name */
- else if (mint)
- {
- strcpy(d, "U:\\dev\\");
- d += 7;
- }
- else
- {
- strcpy(d, u);
- strcat(d, ":");
- if (!strcmp(d, "tty:"))
- strcpy(d, "con:");
- return 1;
- }
- }
- else if (mint && !strncmp(u, "/pipe/", 6))
- {
- u += 6;
- strcpy(d, "U:\\pipe\\"); d += 8;
- }
- else if (*u == '/')
- {
- *d++ = 'U';
- *d++ = ':';
- }
-
- while( (c = *u++) != 0 )
- {
- if (c == '/')
- c = '\\';
- *d++ = c;
- }
- *d = 0;
- return 0;
- }
-